<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="recordId" value="#{determinedRecordrHome.id}"></f:viewParam>
	  	<f:event listener="#{determinedRecordrHome.initConversation()}" type="preRenderView"></f:event>
	   	<f:event listener="#{serviceSupplierManageList.setMaxResults(null)}" type="preRenderView"></f:event>
	   	<f:viewParam name="moduleName" value="待定名单管理"></f:viewParam>
   	</f:metadata>
   
    <ui:define name="head">
    	<style type="text/css">
    		ul.ui-autocomplete-multiple-container {
    			width: 600px;
    		}
    	</style>
    </ui:define>
   
   	<ui:define name="content">
   
		<h:form id="editForm">
			<p:panel rendered="#{not empty determinedRecordrHome.instance.auditted}" header="审核信息">
			        	<p:panelGrid columns="2" cellpadding="5" style="width:98%">
							<p:outputLabel  value="当前操作状态" />	
			       			#{determinedRecordrHome.instance.operationStr()}
						
			       			<p:outputLabel  value="审核状态" />	
			       			#{determinedRecordrHome.instance.audittedStr}
			       			
			       			<p:outputLabel  value="审核人" />		
	
			       			#{determinedRecordrHome.instance.auditUser.cnname}
	
			       			<p:outputLabel  value="审核时间" />		
	
			       			<h:outputText value="#{determinedRecordrHome.instance.auditDate}" >
			       				<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>
			       			</h:outputText>
							<p:outputLabel  value="驳回原因" rendered="#{not empty determinedRecordrHome.instance.rejectRecord}" />
							<h:outputText value="#{determinedRecordrHome.instance.rejectRecord.reason}" rendered="#{not empty determinedRecordrHome.instance.rejectRecord}"  />	
						 </p:panelGrid>	
			    </p:panel>         
				<p:panel id="panel" header="#{determinedRecordrHome.managed ? '修改' : '新增'}待定名单" style="margin-bottom:10px;">
			        <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
			        <h:panelGrid columns="2" cellpadding="5">
			        		    			
						<p:outputLabel  value="中介机构名称" />
						#{determinedRecordrHome.instance.supplier.cnname}
			       		      			
						<p:outputLabel  value="列入待定名单起始期限" />		
						<h:outputText  value="#{determinedRecordrHome.instance.startDate}"  >
							<f:convertDateTime pattern="yyyy-MM-dd"/>
						</h:outputText>
						<p:outputLabel  value="列入待定名单截至期限" />	
						<h:outputText  value="#{determinedRecordrHome.instance.endDate}"  >
							<f:convertDateTime pattern="yyyy-MM-dd"/>
						</h:outputText>  
						 
		       			<p:outputLabel  value="证据材料" />	
		       			<p:dataList var="_attr" value="#{determinedRecordrHome.instance.undeterminedRoster.evidences}">
								<p:commandButton style="margin-left:10px;" ajax="false"  icon="ui-icon-arrowthick-1-s">
							        <p:fileDownload value="#{fileDownloadView.download(_attr)}" />
							        <h:outputText value="#{_attr.filename}" />
							    </p:commandButton>									
						</p:dataList>
							
		       			<p:outputLabel  value="备注" />	
		       			#{determinedRecordrHome.instance.undeterminedRoster.remark}
						
						<p:outputLabel for="attachment" value="整改情况材料" />		
						<p:outputPanel id="attachment">
							<p:fileUpload
								id="attachmentUploadFile"
								label="选择"
								mode="advanced"
								required="true"
								multiple="true"
								skinSimple="true"
								sizeLimit="#{1024 * 1024 * 3}"
								uploadLabel="上传"
								cancelLabel="取消"
								update="editForm:uploadedAttachment"
								fileUploadListener="#{determinedRecordrHome.uploadAttachment}"
							/>
							<p:panel id="uploadedAttachment">
								<ul>
									<p:repeat var="_attachment" value="#{determinedRecordrHome.instance.attachments}">
										<li>
											<h:outputText value="#{_attachment.filename}" />
											<span>
												<p:commandLink style="margin-left:5px;" action="#{determinedRecordrHome.removeAttachment(_attachment)}" update="editForm:uploadedAttachment" immediate="true" >×</p:commandLink>
												<p:commandButton style="margin-left:10px;" ajax="false"  icon="ui-icon-arrowthick-1-s">
											        <p:fileDownload value="#{fileDownloadView.download(_attachment)}" />
											    </p:commandButton>		
											</span>
										</li>
									</p:repeat>
								</ul>
						</p:panel>
					</p:outputPanel>								
					
				</h:panelGrid>
			</p:panel>
			<p:commandButton action="#{determinedRecordrHome.submitToAuditing(false)}" value="删除待定名单" ajax="false" rendered="#{!determinedRecordrHome.instance.auditted}" />
			<p:commandButton  value="保留待定名单" oncomplete="PF('keepDialog').show();"  immediate="true"  rendered="#{!determinedRecordrHome.instance.auditted}" />
		
			<p:commandButton action="#{determinedRecordrHome.cancel()}" value="取消" immediate="true"></p:commandButton>	
		</h:form>
		
		<p:dialog id="keepDialog" widgetVar="keepDialog" width="500" height="300">
			<f:facet name="header">
				保留待定名单
			</f:facet>
			<h:form>
				<p:panelGrid columns="2">
					<p:outputLabel for="newEndDate" value="整改截至日期(新)"></p:outputLabel>
					 <p:calendar
								id="newEndDate"
								value="#{determinedRecordrHome.instance.newEndDate}"
								required="true"
								navigator="true"
								locale="zh_CN"
								showOn="button"
								pattern="yyyy-MM-dd"
								inputStyleClass="input-middle" 
							/>				
				</p:panelGrid>
				<br/>				
				<p:commandButton action="#{determinedRecordrHome.submitToAuditing(true)}" value="保留待定名单" ajax="false" />
				<p:commandButton oncomplete="PF('keepDialog').hide();" value="取消" immediate="true"></p:commandButton>
			</h:form>
		</p:dialog>
   	</ui:define>
</ui:composition>
